<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="include/base.jsp" %>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title>file</title>
	<link rel="stylesheet" href="css/bootstrap.min.css" />
	<link rel="stylesheet" href="css/style.css" />
</head>
<body>
	<div class="container">
	<%@ include file="include/top.jsp"%>
	<!--header end-->
		<div class="content">
			<div class="row">
				<div class="span9">
					<div class="document">
						<ul>
							<li><a href="share.jspx"><i class="icon-folder-open"></i>文件列表</a></li>
							<li class="pull-right"><a href="addfolder.jspx"><i class="icon-plus"></i>创建文件夹</a></li>
						</ul>
					</div>
					<table class="table" style="border-top:1px solid #fff8dc">
					  <thead>
						<tr>
							<th width="5%"></th>
							<th width="30%">名称</th>
							<th width="30%">大小</th>
							<th width="20%">创建人</th>
							<th width="5%"></th>
							<th></th>
						</tr>
					  </thead>
					  <tbody class="tbody">
					  	<c:forEach items="${page.list}" var="folder">
							<tr>
								<td><img src="img/folder.png"/></td>
								<td><a href="singlefile.jspx?id=${folder.id}" class="js-pjax" rel="${folder.id}">${folder.folderName}</a></td>
								<td>${folder.fileNum } files at ${folder.fileTotalSize}</td>
								<td>${folder.employee.name}</td>
								<td><a href="editfolder.jspx?id=${folder.id}" title="修改文件夹名字"><i class="icon-pencil"></i></a></td>
								<td><a href="javascript:;" title="删除该文件夹" rel="${folder.id}" class="delfolder"><i class="icon-trash"></i></a></td>
							</tr>
						</c:forEach>
						<c:if test="${empty page.list}">
							<tr><td colspan="6">还没有创建文件夹</td></tr>
						</c:if>	
					  </tbody>
					</table>
					 <c:if test="${page.totalPage > 1 }">
	                <div class="pagination pull-right">
	                  <ul>
	                  <c:choose>
	                  	<c:when test="${page.pageNum ==1}">
	                    <li><a>首页</a></li>
	                    <li><a>上一页</a></li>
	                    </c:when>
	                    <c:otherwise>
	                    	<li><a href="share.jspx?p=1">首页</a></li>
	                    	<li><a href="share.jspx?p=${page.pageNum-1}">上一页</a></li>
	                    </c:otherwise>
	                    </c:choose>
	                     <c:choose>
	                  	<c:when test="${page.pageNum ==page.totalPage}">
	                    <li><a>下一页</a></li>
	                    <li><a>尾页</a></li>
	                    </c:when>
	                    <c:otherwise>
	                    	<li><a href="share.jspx?p=${page.pageNum+1}">下一页</a></li>
	                    	<li><a href="share.jspx?p=${page.totalPage}">尾页</a></li>
	                    </c:otherwise>
	                    </c:choose>
	                  </ul>
	                </div>
                </c:if>
				</div>
				<div class="span3">
				 <c:if test="${not empty delfoldererr }">
				 	<span style="color:red">${delfoldererr}</span>
				 </c:if>
				 <c:remove var="delfoldererr" scope="session"/>
				  <c:if test="${not empty editfoldererr }">
				 	<span style="color:red">${editfoldererr}</span>
				 </c:if>
				 <c:remove var="editfoldererr" scope="session"/>
				</div>
			</div>
		</div>
		<!--container end-->
		<%@ include file="include/footer.jsp" %>
		<!--footer end-->
	</div>
	
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript" src="js/jquery.pjax.js"></script>
	<script type="text/javascript">
		$(function(){
			$(".delfolder").click(function(){
				var folderId = $(this).attr("rel");
				if(window.confirm("要删除该文件夹吗？")){
					window.location ="delfolder.jspx?id="+folderId;
				}
			});
		});
	</script>
</body>
</html>